<!--传递name给路由触发跳转	
	        	@click="pushToView({name:items.permissionDesc})"
	        	>-->

<template>
	<div id="navMenu">
		 <el-menu
	      default-active="2"
	      class="el-menu-vertical-demo"
	      @open="handleOpen"
	      @close="handleClose"
	      background-color="#545c64"
	      text-color="#fff"
	      active-text-color="#ffd04b">
	      <el-submenu index="1" v-for="(item,key,index) in allMenu" :key="key" :index="String(index)">
	        <template slot="title">
	          <i class="el-icon-location"></i>
	          <span>{{item.permissionDesc}}</span>
	        </template>
	        <el-menu-item index="1-1" v-for="(items,index) in item.children" 
	        	:index="String(index)"
	        	@click="pushToView({name:items.permissionDesc})"
	        	>
	        	{{items.permissionDesc}}
	        </el-menu-item>
	      </el-submenu>
	    </el-menu>
		</div>
	
</template>
<script>
	export default {
    methods: {
        handleOpen(){},
        handleClose(){}
    },
    mounted(){
    	//获取权限数据
    	var menus=JSON.parse(localStorage.getItem('response')).permissions;
    	//通知要出发的mutations里面的函数，并传数据过去进行处理
    	this.$store.commit('FRESHALLMENU',menus)
//  	console.log(this.$store)
//  	console.log(menus)
    },
    computed:{
    	//最后这里得到的就是带有子元素的父级数据对象，3个
    	allMenu(){
    		return this.$store.getters.allMenu;
    	}
    }
}

</script>

<style lang="scss" scoped>
	#navMenu{
		width: 200px;
		height: 100%;
		background: rgb(84,92,100);
	}
</style>
